Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ActionDispatch::Response to be autoloaded #37228

Merged
merged 1 commit into from
Sep 18, 2019

Conversation

eugeneius
Copy link
Member

Similar to #37187, this defers loading ActionDispatch::Response until after initialization, which allows applications to boot a bit faster in development but also paves the way for return_only_media_type_on_content_type to work correctly when set from new_framework_defaults_6_0.rb in #37112.

Co-authored by @serenaf! 🍐

Benchmark:

$ cat test.rb
require "bundler/setup"
before = ObjectSpace.each_object(Module).count
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
require "action_controller"
finish = Process.clock_gettime(Process::CLOCK_MONOTONIC)
after = ObjectSpace.each_object(Module).count
puts "took #{finish - start} and created #{after - before} modules"

Before:

$ ruby test.rb
took 0.35654300000169314 and created 608 modules

After:

$ ruby test.rb
took 0.2770050000108313 and created 466 modules

Similar to b744372, this defers loading
`ActionDispatch::Response` until after initialization, which will allow
applications to boot a bit faster in development but also paves the way
for `return_only_media_type_on_content_type` to work correctly when set
from `new_framework_defaults_6_0.rb`.

Benchmark:

    $ cat test.rb
    require "bundler/setup"
    before = ObjectSpace.each_object(Module).count
    start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
    require "action_controller"
    finish = Process.clock_gettime(Process::CLOCK_MONOTONIC)
    after = ObjectSpace.each_object(Module).count
    puts "took #{finish - start} and created #{after - before} modules"

Before:

    $ ruby test.rb
    took 0.35654300000169314 and created 608 modules

After:

    $ ruby test.rb
    took 0.2770050000108313 and created 466 modules

Co-authored-by: Serena Fritsch <serena@intercom.io>
@rails-bot rails-bot bot added the actionpack label Sep 17, 2019
@kamipo kamipo merged commit 19a2d5c into rails:master Sep 18, 2019
eugeneius pushed a commit to eugeneius/rails that referenced this pull request Oct 1, 2019
…e_autoload

Allow ActionDispatch::Response to be autoloaded
kamipo added a commit that referenced this pull request Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants